<!--  -->
<template>
  <div>
    <el-table :data="Logistic.slice((currentPage-1)*pagesize,currentPage*pagesize)" style="width: 100%">
      <el-table-column prop="lid" label="物流号" width="150%">
      </el-table-column>
      <el-table-column prop="oid" label="订单号" width="150%">
      </el-table-column>
      <el-table-column prop="oaddress" label="物流地址" width="255%">
      </el-table-column>
    <el-table-column label="物流状态" width="215%">
        <template slot-scope="scope">
          {{ scope.row.ostate == 0 ? '派送中' : '已完成' }}
        </template>
      </el-table-column>
      <el-table-column prop="omessage" label="物流信息" width="215%">
      </el-table-column>
    </el-table>
     <!--分页区域-->
  <el-pagination
      @size-change="size_change" 
      @current-change="current_change"  
      :current-page="currentPage"  
      :page-sizes="[2,3,5]"  
      :page-size="pagesize"  
      layout="total, sizes, prev, pager, next, jumper"  
      :total="Logistic.length"> 
  </el-pagination>
  </div>


</template>
<script >
const axios = require("axios");
axios.defaults.baseURL = '/api/'
export default {
  data() {
    return {
      Logistic: [],
      // //添加用户
      // dialogTableVisible: false,
      // //修改用户
      // dialogFormVisible4Edit:false,
      logistic:{
        lid:'',
        oid: '',
        oaddress:'',
        ostate:'',
        omessage:''
      },
      formLabelWidth: '120px',
      total:0,//总条目数
        pagesize:10,//每页显示条目个数
        currentPage:1,//当前页数
    }
  },
  props: [],
  components: {},
  created() {
    this.findAll();
    this.size_change(5);
    
  },
  mounted() {
  },
  methods: {
    findAll() {
      axios.get('/logistic/getLogisticList').then(res => {
        this.Logistic = res.data;
        console.log(res.data);
      })
    },
     size_change(newSize){
       this.pagesize = newSize
   },
   //监听 页码值 改变的事件
   current_change(newPage){
       this.currentPage = newPage
   },
    // cancel: function () {
    //   this.$message.info("当前操作已取消")
    //   this.dialogTableVisible = false,
    //   this.dialogFormVisible4Edit=false
    // },
    // addUser: function () {
    //   console.log(this.user.startday);
    //   axios({
    //     method: 'POST',
    //     url: '/users/addUsers',
    //     data: this.user
    //   })
    //     .then((resp) => {
    //       this.dialogTableVisible = false;
    //       this.$message.success("添加成功");
    //       this.findAll();
    //     })
    // },
    // updateUser: function(users){
    //   this.ordered=users;
    //   this.dialogFormVisible4Edit=true
    // },
    // modifyUser: function(){
    //   axios({
    //     method:'PUT',
    //     url:'/users/updateUsers',
    //     data: this.ordered
    //   }).then(res=>{
    //     this.dialogFormVisible4Edit=false,
    //     this.$message.success("修改成功");
    //     this.findAll();
    //   })
    // },
    // deleteLogistic: function (logistic) {
    //   console.log(logistic.oid);
    //   axios({
    //     method: 'delete',
    //     url: '/logistic/deleteLogistic/' + logistic.lid,
    //   })
    //     .then((res) => {
    //       this.$message.success('删除成功');
    //       this.findAll();
    //     })
    // }



  }
};
</script>
<style lang='scss'>
</style>